<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>优惠券管理</title>
    <link rel="icon" href="favicon.ico" type="images/ico">
    <meta name="author" content="dc">
    <link rel="stylesheet" type="text/css" href="/css/materialdesignicons.min.css">
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/css/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/css/style.min.css">

    <link href="/js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" />
<!--    &lt;!&ndash;固定table列&ndash;&gt;-->
    <link href="/js/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.min.css" rel="stylesheet"/>

    <link rel="stylesheet" href="/js/jquery-confirm/jquery-confirm.min.css" />
    <link rel="stylesheet" href="/css/input_tags.css"/>
<!--    &lt;!&ndash;时间选择插件&ndash;&gt;-->
    <link rel="stylesheet" href="/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
<!--    &lt;!&ndash;日期选择插件&ndash;&gt;-->
    <link rel="stylesheet" href="/js/bootstrap-datepicker/bootstrap-datepicker3.min.css">
    <link rel="stylesheet" href="/js/need/verfont.css" />
<!--    &lt;!&ndash; 多选下拉 &ndash;&gt;-->
    <link rel="stylesheet" href="/css/bootstrap-multiselect.css" type="text/css"/>
    <link rel="stylesheet" href="/css/bootstrap-select.css" type="text/css"/>
    <link rel="stylesheet" href="/css/bootstrapValidator.min.css" />
    <link rel="stylesheet" href="/css/skin.css"/>
    <link rel="stylesheet" href="/css/finance/payment-record.css">

    <style>
        .tab-cont{
            display: none;
        }
        .tab-active{
            display: block;
        }
        .card .filter-content input, .card .filter-content select{
            height: 30px;
        }
        .form-well .form-content:before, .form-well .form-content:after{
            display: block;
        }
        .nomemberProductListTable{
            display: none;
        }
        .coupon-quota,.coupon-discount{
            display: none;
        }



        body {
            overflow: scroll;
        }

    </style>
</head>
<body>
<input type="hidden" id="esurl" name="esurl" th:value="${esurl}"/>
<div class="container-fluid p-t-15">
    <input type="hidden" id="sysParameterId">
    <div class="row">
        <div class="col-sm-12">
            <div class="card">
                <div class="card-header">
                    <h1>优惠券管理</h1>
                </div>
                <div class="card-body">
                    <div class="row content-action">
                        <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                            <div class="time-search pull-left">
                                <input type="hidden" id="couponType" name="discountCoupon" value="discountCoupon"/>
                                <div class="discountCoupon active-second" onclick="selectPlan('discountCoupon')">通用优惠券管理</div>
                                <div class="activityCoupon" onclick="selectPlan('activityCoupon')">活动优惠券管理</div>
                                <div class="repairCoupon" onclick="selectPlan('repairCoupon')">派发优惠券管理</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="card-body tab-cont tab-active">
                    <div class="row content-action">
                        <div class="col-lg-12 col-md-5 col-sm-5 col-xs-12">
                            <button style="margin: 0;" type="button" class="btn btn-label btn-success" onclick="addNewCoupon()" >
                                <label><i class="mdi mdi-plus"></i></label>添加优惠券
                            </button>
                            <div class="pull-right">
                                <div class="min-search pull-left">
                                    <input class="form-control" type="text" placeholder="请输入优惠券名称"
                                           id="couponName" name="couponName">
                                    <button class="btn btn-primary" type="button" onclick="searchOrderLists()">
                                        <i class="mdi mdi-magnify"></i><span>搜索</span>
                                    </button>
                                </div>
                                <!--<button class="btn btn-default btn-senior" data-toggle="collapse" data-target="#filterContent"
                                        aria-expanded="false" aria-controls="filterContent"><i class="mdi mdi-sort-variant">
                                </i>高级筛选
                                </button>-->
<!--                                <button class="btn btn-default" data-toggle="collapse"-->
<!--                                        data-target="#addCoupon" aria-expanded="false"-->
<!--                                        aria-controls="addCoupon">-->
<!--                                    <i class="mdi mdi-sort-variant"></i>添加优惠券-->
<!--                                </button>-->
                            </div>
                        </div>
                    </div>
                    <table id="discountCouponFrom"></table>
                </div>

                <div class="card-body tab-cont">
                </div>

                <div class="card-body tab-cont">
                    <div class="row content-action">
                        <div class="col-lg-12 col-md-5 col-sm-5 col-xs-12">
                            <div class="pull-left">
                                <button class="btn btn-default " data-toggle="modal"
                                        aria-expanded="false"
                                        aria-controls="batchSend" onclick="batchSendTarget()">
                                    批量发放
                                </button>
                            </div>
                            <div class="pull-right">
                                <div class="min-search pull-left">
                                    <input class="form-control" type="text" placeholder="请输入订单编号"
                                           id="orderNumber" name="orderNumber">
                                    <button class="btn btn-primary" type="button" onclick="searchOrderList()">
                                        <i class="mdi mdi-magnify"></i><span>搜索</span>
                                    </button>
                                </div>
                                <button class="btn btn-default btn-senior" data-toggle="collapse" data-target="#filterContentNew"
                                        aria-expanded="false" aria-controls="filterContentNew"><i class="mdi mdi-sort-variant">
                                </i>高级筛选
                                </button>

                            </div>
                        </div>
                    </div>

                    <div class="collapse filter-content" id="filterContentNew">
                        <div class="row">

                            <div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12">
                                <label class="control-label" for="startDate">订单完成日期</label>
                                <div class="form-content input-group">
                                    <input type="text" id="startDate" class="form-control search-time date-input"
                                           placeholder="起" autocomplete="off">
                                    <span class="input-group-addon">-</span>
                                    <input type="text" id="endDate" class="form-control search-time date-input"
                                           placeholder="止" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12">
                                <label class="control-label" for="startMoney">订单金额</label>
                                <div class="form-content input-group">
                                    <input type="text" id="startMoney" class="form-control"
                                           placeholder="起">
                                    <span class="input-group-addon">-</span>
                                    <input type="text" id="endMoney" class="form-control"
                                           placeholder="止">
                                </div>
                            </div>

                            <div class="form-group col-lg-8 col-md-8 col-sm-8 col-xs-12">
                                <label class="control-label" for="startDate">包含产品</label>
                                <div class="form-content input-group" style="display: flex">

                                    <select id="contractStatusSelectMultiple" name="contractStatusSelectMultiple" class="form-control form-btn" multiple="multiple" data-live-search="true" type="text" title="请选择会员产品">

                                    </select>


                                    <span style="display: inline-block;width: 20px;"></span>


                                    <select id="contractSelectMultiple" name="contractSelectMultiple" class="form-control form-btn" multiple="multiple" data-live-search="true" type="text" title="请选择非会员产品">

                                    </select>


                                </div>
                            </div>

                            <div class="clearfix hidden-xs"></div>
                            <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                <label>&nbsp;</label>
                                <div class="text-right">
                                    <button class="btn btn-link" onclick="resetAllData()">重置</button>
                                    <button class="btn btn-primary" type="button" id="btn-search" onclick="searchOrderList()">
                                        <i class="mdi mdi-magnify"></i><span>搜索</span></button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <table id="discountReissueTable"></table>
                </div>


            </div>
        </div>
    </div>
</div>

<!-- 优惠券修改 弹窗 -->
<div class="modal fade bs-example-modal-lg modal-edit" tabindex="-1" role="dialog" id="addCoupon" style="overflow-y: scroll;">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content" style="position: relative;">
            <div class="modal-header">
                <h4>优惠券修改</h4>
            </div>
            <input type="hidden" id="couponIdHide" value="null">
            <div class="modal-body" style="margin-bottom: 40px;">
                <div class="well form-well ">
                    <div class="header-file"  >
                        <div class="header-init" >
                            <h3>优惠券信息</h3>
                        </div>
                        <div>
                            <form id=""  autocomplete="off" class="form-coupon">
                                <div class="edit-product" >

                                    <div class="" style="padding: 0 20px;box-sizing: border-box;display: flex;flex-wrap: wrap;">
                                        <input type="hidden" id="chsCustomerCouponId">
                                        <div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12">
                                            <label class="control-label label-required" >优惠券名称</label>
                                            <div class="form-content">
                                                <input id="couponNameInput" name="couponNameInput" type="text" class="form-control" placeholder="请输入"  data-live-search="true">

                                            </div>
                                        </div>

                                        <div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12">
                                            <label class="control-label label-required" >优惠券数量</label>
                                            <div class="form-content">
                                                <input id="couponCount" name="couponCount" type="text" class="form-control" placeholder="请输入"  data-live-search="true">
                                            </div>
                                        </div>

                                        <div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12 coupon-quota">
                                            <label class="control-label label-required" >优惠券额度</label>
                                            <div class="form-content">
                                                <input id="couponQuota" name="couponQuota" type="text" class="form-control" placeholder="请输入"  data-live-search="true">
                                            </div>
                                        </div>

                                        <div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12 coupon-discount">
                                            <label class="control-label label-required" >优惠券优惠折扣</label>
                                            <div class="form-content">
                                                <input id="couponDiscount" name="couponDiscount" type="text" class="form-control" placeholder="请输入"  data-live-search="true">
                                            </div>
                                        </div>



                                        <div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12">
                                            <label class="control-label label-required" >使用方式</label>
                                            <div class="form-content">
                                                <select id="useType" title="使用方式" name="useType" class="form-control selectpicker"  data-live-search="true">
                                                    <option value="">请选择</option>
                                                    <option value="0">叠加使用</option>
                                                    <option value="1">不可叠加</option>
                                                </select>
                                            </div>
                                        </div>


                                        <div class="form-group col-lg-8 col-md-8 col-sm-8 col-xs-12">
                                            <label class="control-label label-required" >优惠券使用有效期</label>
                                            <div class="form-content input-group">
                                                <input id="validPeriodStart" type="text" name="validPeriodStart" class="form-control" placeholder="请选择开始时间"  autocomplete="off">
                                                <span class="input-group-addon">至</span>
                                                <input type="text" id="validPeriod" name="validPeriod" class="form-control date-input" placeholder="请输入截止时间" autocomplete="off">
                                            </div>
                                        </div>





                                    </div>
                                </div>
                                <div class="card-actions pull-right " style="position: absolute;padding-top: 40px;right: 45%;bottom: -20px;">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                    <button class="btn btn-primary"  type="button" onclick="editSubmit()">提交</button>
                                </div>
                            </form>
                        </div>

                    </div>
                </div>
                <input type="hidden" id="scopeOfApplication">
                <div class="well form-well active-coupon">
                    <div class="header-file">
                        <div class="header-init" >
                            <h3>优惠券适用产品</h3>

                        </div>
                    </div>
                    <div class="pull-right " style="margin-bottom:20px;">
                        <button type="button" class="btn btn-success btn-label"
                                data-toggle="modal"
                                data-target="#addProduct"
                                aria-expanded="false"
                                aria-controls="addProduct"
                                onclick="addProductFun()"
                        ><label><i class="mdi mdi-plus"></i></label>添加产品</button>
                    </div>
                    <div class="clearfix" >
                        <table id="productNameList" ></table>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>


<!-- 批量补发 弹窗 -->
<div class="modal fade bs-example-modal-lg modal-edit" tabindex="-1" role="dialog" id="batchSend">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4>批量补发</h4>
            </div>

            <div class="row" style="padding: 30px;">
                <table id="reissueTable"></table>
                <div class="clearfix hidden-xs"></div>

                <div class="text-right">
                    <button class="btn btn-primary" type="button" onclick="batchSendSubmit()" >
                        <span>发放</span></button>
                    <button class="btn btn-default" data-dismiss="modal" >取消</button>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 添加产品 弹窗 -->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="addProduct">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4>添加产品</h4>
            </div>
            <div class="modal-body">
                <input type="text" value="1" id="productModalType" hidden>
                <div class="headerContainer clearfix">
                    <ul class="new-tabs pull-left col-lg-12 col-md-12 col-sm-12 col-xs-12">
                        <!-- 全部 会员客户 非会员客户-->
                        <li class="nav-item active">
                            <a href="#" data-toggle="tab" aria-expanded="false"  onclick="memberProductFunClick(0)">会员产品</a>
                        </li>
                        <li class="nav-item">
                            <a href="#" data-toggle="tab" aria-expanded="false"  onclick="memberProductFunClick(1)">非会员产品</a>
                        </li>
                    </ul>
                </div>
                <div class="memberProductListTable">
                    <table id="memberProductListTable"></table>
                </div>
                <div class="nomemberProductListTable" >
                    <table id="nomemberProductListTable"></table>
                </div>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" onclick="addPartProduct()">确定</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>

</body>

<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/js/main.min.js"></script>
<script type="text/javascript" src="/js/bootstrap-table/bootstrap-table.min.js"></script>
<script type="text/javascript" src="/js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="/js/popper.min.js"></script>
<script type="text/javascript" src="/js/jquery.cookie.min.js"></script>
<script src="/js/crm/common/input-tag.js"></script>
<script src="/js/crm/common/city.js"></script>
<!--table固定列-->
<script type="text/javascript" src="/js/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.js"></script>
<!-- 拖动 -->
<script src="/js/bootstrap-table/extensions/resizable/bootstrap-table-resizable.min.js"></script>
<script src="/js/crm/common/colResizable-1.6.min.js"></script>

<!--时间选择插件-->
<script src="/js/bootstrap-datetimepicker/moment.min.js"></script>
<script src="/js/jquery-confirm/jquery-confirm.min.js"></script>
<script src="/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script src="/js/bootstrap-datetimepicker/locale/zh-cn.js"></script>
<!--日期选择插件-->
<script src="/js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="/js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<script type="text/javascript" src="/js/crm/common/dataRangePicker.min.js"></script>
<script src="/js/verSelect.2.0.js"></script>
<!-- 多选框下拉 -->
<script type="text/javascript" src="/js/bootstrap-multiselect.js"></script>
<script type="text/javascript" src="/js/bootstrap-select.js"></script>
<script type="text/javascript" src="/js/bootstrap.lyear.dropdowntree.min.js"></script>
<!-- 子页面公用js -->
<script type="text/javascript" src="/js/bootstrapValidator.min.js"></script>
<script src="/js/crm/common/pageCommon.js"></script>
<script src="/js/bootstrapTableSelect.js"></script>
<script src="/js/crm/activityManager/discountCoupon.js"></script>
</html>